package com.zyd.andriudiot.socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

public class SocketClientTest {

    public static void main(String[] args) {
        System.out.println("测试Socket");
        try {
            Socket s = new Socket();
//            s.setSoLinger(true,0);//设置调用close就发送RST
            s.connect(new InetSocketAddress("127.0.0.1",3113));
            OutputStream os = s.getOutputStream();
            os.write("hello".getBytes());
            s.close();
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    //Broken pipe
}
